package com.syht.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.syht.tools.StringTools;

@Service
public class ChargeMarkService {

	@Autowired
	private IChargeMarkDao chargeMarkDao;
	
	public boolean addChargeMark(ChargeMark chargeMark) throws Exception{
		
		if(null == chargeMark)
			
			return false;
		if(null == chargeMark.getCmValue())
			
			return false;
		
		if(StringTools.isEmpty(chargeMark.getCmType()))
		
			return false;
		
		if(chargeMarkDao.addChargeMark(chargeMark) > 0)
			
			return true;
		else
			
			return false;
	}
	
	public Integer getChargeMarkId(String cmType) throws Exception{
		
		if(StringTools.isEmpty(cmType))
			
			throw new Exception();
		return chargeMarkDao.getChargeMarkId(cmType);
	}
	
	public void clear() throws Exception{
		
		chargeMarkDao.clear();
	}
}
